


export function readImage(file) {
    return new Promise((resolve, reject) => {
        const reader = new FileReader();
        const image = new Image();
        reader.onload = (e) => {
            image.src = e.target.result
        };
        reader.onerror = (e) => {
            reject(e);
        };
        reader.readAsDataURL(file);
        image.onload = () => {
            resolve(image);
        };
        image.onerror = (e) => {
            reject(e);
        };
    })
}